/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.tech15.task.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.tech15.task.model.*;
import com.tech15.task.dao.*;
import com.tech15.task.service.*;
import com.tech15.task.vo.query.*;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "TASK_PROCESS")
public class TaskProcess extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "任务处理过程";
	public static final String ALIAS_TPID = "序号";
	public static final String ALIAS_TASKID = "任务id";
	public static final String ALIAS_HANLDER = "办理人";
	public static final String ALIAS_TASKTIME = "任务时间";
	public static final String ALIAS_HANLDTIME = "办理时间";
	public static final String ALIAS_HANLDRESULT = "办理结果";
	public static final String ALIAS_OPTTYPE = "操作类型（1审批 2执行）";
	public static final String ALIAS_HANLDETYPE = "办理类型（1主办 2协办）";
	public static final String ALIAS_HANLDESTATE = "办理状态（0 待处理 2 待审 1完成）";
	
	//date formats
	public static final String FORMAT_TASKTIME = DATE_TIME_FORMAT;
	public static final String FORMAT_HANLDTIME = DATE_TIME_FORMAT;
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 序号       db_column: TPID 
     */ 	
	
	private Long tpid;
    /**
     * 任务id       db_column: TASKID 
     */ 	
	
	private Long taskid;
    /**
     * 办理人       db_column: HANLDER 
     */ 	
	
	private Long hanlder;
    /**
     * 任务时间       db_column: TASKTIME 
     */ 	
	
	private java.util.Date tasktime;
    /**
     * 办理时间       db_column: HANLDTIME 
     */ 	
	
	private java.util.Date hanldtime;
    /**
     * 办理结果       db_column: HANLDRESULT 
     */ 	
	@Length(max=400)
	private java.lang.String hanldresult;
    /**
     * 操作类型（1审批 2执行）       db_column: OPTTYPE 
     */ 	
	@Max(127)
	private Integer opttype;
    /**
     * 办理类型（1主办 2协办）       db_column: HANLDETYPE 
     */ 	
	@Max(127)
	private Integer hanldetype;
    /**
     * 办理状态（0 待处理 2 待审 1完成）       db_column: HANLDESTATE 
     */ 	
	@Max(127)
	private Integer hanldestate;
	 /**
     * 任务动作（0执行 1审批 2结束）       db_column: taskaction 
     */ 	
	@Max(127)
	private Integer taskaction;
	/**
     * 指派人       db_column: ZPR 
     */ 	
	private Long zpr;
	//columns END


	public TaskProcess(){
	}

	public TaskProcess(
		Long tpid
	){
		this.tpid = tpid;
	}

	

	public void setTpid(Long value) {
		this.tpid = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "increment")
	@Column(name = "TPID", unique = true, nullable = false, insertable = true, updatable = true, length = 22)
	public Long getTpid() {
		return this.tpid;
	}
	
	@Column(name = "TASKID", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getTaskid() {
		return this.taskid;
	}
	
	public void setTaskid(Long value) {
		this.taskid = value;
	}
	
	@Column(name = "HANLDER", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getHanlder() {
		return this.hanlder;
	}
	
	public void setHanlder(Long value) {
		this.hanlder = value;
	}
	
	@Transient
	public String getTasktimeString() {
		return DateConvertUtils.format(getTasktime(), FORMAT_TASKTIME);
	}
	public void setTasktimeString(String value) {
		setTasktime(DateConvertUtils.parse(value, FORMAT_TASKTIME,java.util.Date.class));
	}
	
	@Column(name = "TASKTIME", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public java.util.Date getTasktime() {
		return this.tasktime;
	}
	
	public void setTasktime(java.util.Date value) {
		this.tasktime = value;
	}
	
	@Transient
	public String getHanldtimeString() {
		return DateConvertUtils.format(getHanldtime(), FORMAT_HANLDTIME);
	}
	public void setHanldtimeString(String value) {
		setHanldtime(DateConvertUtils.parse(value, FORMAT_HANLDTIME,java.util.Date.class));
	}
	
	@Column(name = "HANLDTIME", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public java.util.Date getHanldtime() {
		return this.hanldtime;
	}
	
	public void setHanldtime(java.util.Date value) {
		this.hanldtime = value;
	}
	
	@Column(name = "HANLDRESULT", unique = false, nullable = true, insertable = true, updatable = true, length = 400)
	public java.lang.String getHanldresult() {
		return this.hanldresult;
	}
	
	public void setHanldresult(java.lang.String value) {
		this.hanldresult = value;
	}
	
	@Column(name = "OPTTYPE", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
	public Integer getOpttype() {
		return this.opttype;
	}
	
	public void setOpttype(Integer value) {
		this.opttype = value;
	}
	
	@Column(name = "HANLDETYPE", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
	public Integer getHanldetype() {
		return this.hanldetype;
	}
	
	public void setHanldetype(Integer value) {
		this.hanldetype = value;
	}
	
	@Column(name = "HANLDESTATE", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
	public Integer getHanldestate() {
		return this.hanldestate;
	}
	
	public void setHanldestate(Integer value) {
		this.hanldestate = value;
	}
	
	@Column(name = "TASKACTION", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
	public Integer getTaskaction() {
		return this.taskaction;
	}
	
	public void setTaskaction(Integer value) {
		this.taskaction = value;
	}
	
	@Column(name = "ZPR", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getZpr() {
		return this.zpr;
	}
	
	public void setZpr(Long value) {
		this.zpr = value;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Tpid",getTpid())
			.append("Taskid",getTaskid())
			.append("Hanlder",getHanlder())
			.append("Tasktime",getTasktime())
			.append("Hanldtime",getHanldtime())
			.append("Hanldresult",getHanldresult())
			.append("Opttype",getOpttype())
			.append("Hanldetype",getHanldetype())
			.append("Hanldestate",getHanldestate())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getTpid())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof TaskProcess == false) return false;
		if(this == obj) return true;
		TaskProcess other = (TaskProcess)obj;
		return new EqualsBuilder()
			.append(getTpid(),other.getTpid())
			.isEquals();
	}
	
	private String username;
	private String zprxm;

	@Transient
	public String getZprxm() {
		return zprxm;
	}

	public void setZprxm(String zprxm) {
		this.zprxm = zprxm;
	}

	@Transient
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
}

